package com.cn.wanxi.service;

import com.cn.wanxi.dao.NewsDao;
import com.cn.wanxi.model.NewsModel;

import java.util.ArrayList;
import java.util.List;

public class NewsService {
    public List<NewsModel> getNewsModelList() {
        List<NewsModel> list=new ArrayList<>();
        NewsDao newsDao=new NewsDao();
        int length=newsDao.getContent().length;
        for (int i=0;i< length;i++){
            NewsModel newsModel=new NewsModel();
            newsModel.setContent(newsDao.getContent()[i]);
            newsModel.setTitle(newsDao.getTitles()[i]);
            list.add(newsModel);

        }
        return list;
    }

}
